<template>
  <div class="tabdetial">
    <Nav></Nav>
    <div class="banner-wrap">
      <img class="banner" :src="type == 1 ? tabdetailBg : type == 2 ? tabdetailBg2 : tabdetailBg4" />
      <!-- <div class="btn">点击查看</div> -->
    </div>
    <div class="wrap">
    
      <!-- <div class="btn">点击查看</div> -->
      <div class="tab">
        <span class="line"></span>
        <span>{{type == 1 ?'省属': ''}}{{list[type]}}</span>
        <span>大学推荐</span>
        <span class="more" @click="goToMore(province_schools[0].category_id)"> <img src="../../assets/pc/homepage-more.png" /></span>
   
      </div>
        <div class="introduce-wrap">
        <div
          class="introduce-wrap-item"
        >
          <introduceProjectSchool
            :index="index"
            :introduce="province_schools"
            :readMore="false"
            :typeBg="type == 1 ? 1 : 2"
          ></introduceProjectSchool>
        </div>
      </div>
      <!-- <div class="schools">
        <div
          class="schools-wrap"
          v-for="(item,index) in info.province_schools"
          :key="item"
        >
          <schoolProject :introduce="item" :index="index"></schoolProject>
        </div>
      </div> -->

       <div v-if="type == 1" class="tab">
        <span class="line"></span>
         <span>{{type == 1 ?'高水平': ''}}{{list[type]}}</span>
        <span>大学推荐</span>
        <span class="more" @click="goToMore(info.high_schools[0].category_id)"> <img src="../../assets/pc/homepage-more.png" /></span>
      </div>
      <!-- <div class="schools">
        <div
          class="schools-wrap"
          v-for="(item,index) in info.province_schools"
          :key="item"
        >
          <schoolProject :introduce="item" :index="index"></schoolProject>
        </div>
      </div> -->
        <div v-if="type == 1" class="introduce-wrap">
        <div
          class="introduce-wrap-item"
        >
          <introduceProjectSchool
            :index="index"
            :introduce="info.high_schools"
            :readMore="false"
             typeBg="2"
          ></introduceProjectSchool>
        </div>
      </div>
     <div class="tab">
        <span class="line"></span>
        <span>资讯中心</span>
        <span>{{list[type]}}</span>
        <span class="more" @click="goToZXMore(info.article[0].category_id)"> <img src="../../assets/pc/homepage-more.png" /></span>
      </div>

    <div class="introduce-wrap">
    <div
        class="introduce-wrap-item"
        v-for="(item, index) in info.article"
        @click="gotoSchool(item.id)"
        :key="item.name"
    >
        <consultationProject
        :changeFlag="false"
        :index="index"
        :introduce="item"
        :readMore="false"
        ></consultationProject>
    </div>
    </div>



    </div>

    <Footer></Footer>
  </div>
</template>

<script setup>

import introduceProjectSchool from '../../components/pc/introduceProjectSchool.vue';
import Footer from '../../components/pc/Footer.vue';
import Nav from '../../components/pc/nav.vue';
import consultationProject from '../../components/pc/consultationProject.vue';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import { getTrinityPC,getPlanPC, getForwardPC} from '../../api/apiList/pcApi.js';
import tabdetailBg from '../../assets/pc/tabdetail-bg.png';
import tabdetailBg2 from '../../assets/pc/tabdetail-bg2.png';
import tabdetailBg4 from '../../assets/pc/tabdetail-bg4.png';
const list = ref([])
list.value = ['0','三位一体','强基计划','浙江新高考','高职提前批']
const route = useRoute();
const type = route.query.type;
let info = ref({});
let currentIndex = ref(-1);
let province_schools = ref({})
import { useRouter } from 'vue-router';
const router = useRouter();
const goToMore = (id) => {
  router.push({ path: '/schoolRecommendPc', query: { id,type } });
};
const goToZXMore = (id) => {
  router.push({ path: '/zixunListPc' , query: { id, type } });
};

onMounted(async () => {
  console.log(11);
  if(type == 1){
     // 获取列表数据
    await getTrinityPC().then((res) => {
      const { result } = res;
      info.value = result;
      province_schools.value = info.value.province_schools
    });
  }else if(type == 2){
     await getPlanPC().then((res) => {
      const { result } = res;
      info.value = result;
      province_schools.value = info.value.chools
    });
  }else if(type == 4){
     await getForwardPC().then((res) => {
       const { result } = res;
      info.value = result;
      province_schools.value = info.value.chools
    });
  }

});

</script>

<style lang="less" scoped>
.tabdetial {
   .more {
        cursor: pointer;
        position: absolute;
        right: 0;
        top:0;
        font-weight: bold;
        color: #034171;
        font-size: 18Px;
        text-align: right;
        img {
            width: 120Px;
        }
    }
  .wrap {
    position: relative;
    width: 1201Px;
    margin: 0 auto;
    .btn {
      position: absolute;
      left: 289Px;
      top: -110Px;
      text-align: center;
      line-height: 60Px;
      width: 293Px;
      height: 60Px;
      background: #ffffff;
      border-radius: 40Px;
      font-size: 32Px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #666666;
    }
  }
  .banner-wrap {
    position: relative;
    width: 100vw;
    height: auto;
  }
  .banner {
    width: 100vw;
    height: auto;
    margin-bottom: 30Px;
  }
  .tab {
    position: relative;
    font-size: 23Px;
    margin-top: 30Px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #000;
    line-height: 40Px;
    margin-bottom: 30Px;
    display: flex;
    align-items: center;
    .line {
        width: 3Px;
        height: 20Px;
        background: linear-gradient(140deg, #011a35 0%, #000000 100%);
    }
    span {
      display: inline-block;
      margin-right: 20Px;
    }
  }

.introduce-wrap {
    margin-top: 15Px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }
}
</style>
